#ifndef _RETRO_FRAMESTATE
#define _RETRO_FRAMESTATE

namespace Retro
{
  namespace Creator
  {
    enum FrameFlag
    {
      FlagEmbedPlayer   = 0x00000001,
      FlagHideToolBar   = 0x00000002,
      FlagHideStatusBar = 0x00000004,
      FlagHideMenuBar   = 0x00000008,
    };

    enum EditorFlag
    {
      FlagShowGrid      = 0x00000001,
      FlagShowIndices   = 0x00000002,
      FlagSnapToGrid    = 0x00000004,
    };

    class NOVTABLE FrameState
    {
    public:
      struct Header
      {
        union
        {
          BYTE  data[1024 * 4];

          struct
          {
            Geom::Bounds    bounds;
            BOOL            maximized;
            INT             theme;
            INT             editorFlags;
            INT             frameFlags;
            Geom::RGBColor  gridColor;
          };
        };
      };

    private:
      Header  header;

    public:
      INL Header& getData()
      {
        return header;
      }

      INL const Header& getData() const
      {
        return header;
      }

      INL BOOL isFlagSet(EditorFlag iFlag) const
      {
        return (header.editorFlags & (INT)iFlag) == (INT)iFlag;
      }

      INL BOOL isFlagSet(FrameFlag iFlag) const
      {
        return (header.frameFlags & (INT)iFlag) == (INT)iFlag;
      }

      INL VOID setFlag(EditorFlag iFlag, BOOL iSet)
      {
        if (iSet)
          header.editorFlags |= (INT)iFlag;
        else
          header.editorFlags &= ~(INT)iFlag;
      }

      INL VOID setFlag(FrameFlag iFlag, BOOL iSet)
      {
        if (iSet)
          header.frameFlags |= (INT)iFlag;
        else
          header.frameFlags &= ~(INT)iFlag;
      }

      BOOL  load(PCTSTR iFilename);
      BOOL  save(PCTSTR iFilename);
    };
  } // namespace Creator
} // namespace Retro

#endif